package com.hex.liyue.usermodule.bean;

import android.text.TextUtils;

import com.hex.liyue.commonmodule.bean.BaseBean;
import com.hex.liyue.commonmodule.utils.L;

import net.sourceforge.pinyin4j.PinyinHelper;

import java.util.List;

/**
 * Created by yukuo on 2016/5/13.
 */
public class MachPhoneResultBean extends BaseBean {
    public List<DataBean> data;

    public static class DataBean {
        public String uid;
        public String hx_id;
        public String mobile;
        public String sex;
        public String name;
        public String avatar;
        public String self_invite_code;
        public String invite_code;
        public String status;
        public String balance;
        public String create_time;
        public String nickname;
        public String birthday;
        public String star_sign;
        public String signature;
        public String registered;
        public String pinyin;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
            this.pinyin = getHeadChar(name);
        }

        /**
         * 得到首字母
         *
         * @param str
         * @return
         */
        public String getHeadChar(String str) {
            String convert = "";
            if (!TextUtils.isEmpty(str)) {
            char word = str.toString().trim().charAt(0);
            L.e("111111111111111111111",String.valueOf(word));
                String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word);
                if (pinyinArray != null) {
                    convert += pinyinArray[0].charAt(0);
                } else {
                    convert += word;
                }
                return convert.toUpperCase();
            }else{
                return str;
            }
        }
    }
}
